package com.itheima.day14.day14work1;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/*分析以下需求，并用代码实现
        一共有100水杯,请通过实体店和官网来进行销售
        最后统计实体店和官网分别出售的数量*/
public class Dem01 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Water w = new Water(100);
        ShiTiDian std = new ShiTiDian(w);
       WangDian wd = new WangDian(w);
        FutureTask<Integer> ft = new FutureTask<>(std);
        FutureTask<Integer> ft1 = new FutureTask<>(wd);
        Thread t = new Thread(ft);
        Thread t1 = new Thread(ft1);
        t.start();
        t1.start();
        System.out.println("实体店"+ft.get());
        System.out.println("网点"+ft1.get());
    }
}
